﻿namespace IntoCommon.Util
{
    /// <summary>
    /// 上升沿触发器
    /// </summary>
    public class TrigR
    {

        private bool m_Last = false;
        public bool Clk
        {
            set
            {
                Q = value & !m_Last;
                m_Last = value;
            }
        }
        public bool Q { get; private set; }
    }

    /// <summary>
    /// 下降沿信号
    /// </summary>
    public class TrigF
    {
        private bool m_Last = false;
        public bool Clk
        {
            set
            {
                Q = !value && m_Last;//1变0 上次为真本次为假
                m_Last = value;
            }
        }
        public bool Q { get; private set; }
    }
}
